#ifndef MOVEABLEOBJECT_H
#define MOVEABLEOBJECT_H

#include "BaseObject.h"
#include "SettingsManager.h"

enum MoveState
{
	MOVE_IDLE,
	MOVE_NORMAL,
	MOVE_JUMPUP,
	MOVE_JUMPDOWN,
	MOVE_ATTACK,
	MOVE_ATTACK2,
	MOVE_ATTACK3,
	MOVE_BLOCK,
	MOVE_AIR,
	MOVE_LEFT,
	MOVE_STUN,
	MOVE_ATTACK_SHIELD,
	MOVE_INTERRUPTIBLE,
	MOVE_PREPARESHOOT,
	MOVE_SHOOT,
	MOVE_WALL_LEFT,
	MOVE_WALL_RIGHT,
	MOVE_DEATH
};

class MoveableObject :
	public BaseObject
{
public:
	MoveableObject(std::string objectID);
	MoveableObject(boost::shared_ptr<SettingsManager> sm);
	MoveableObject(const OgreDataPtr ogreData,
				   const BulletDataPtr bulletData,
				   const float maxSpeed = 10.0f,
				   const float jumpPower = 10.0f);
	virtual ~MoveableObject(void);
	virtual void update(const unsigned long elapsedTime);
	const float getSpeed(void) const;
	void setSpeed(const float speed);
	const float getMaxSpeed(void) const;
	const float getJumpPower(void) const;
	virtual void setSound(const SoundType type, const ALuint source);
	virtual const ALuint getSound(const SoundType type) const;
	void readMoveableFromXML(boost::shared_ptr<SettingsManager> sm);
	virtual void moveLeft(void);
	virtual void moveRight(void);
	virtual void jump(void);
	virtual void scalePower(const char power);
	void lookLeft(void);
	void lookRight(void);
	map<MoveState, bool> &getStates(void);
	const MoveState getMoveState(void) const;
protected:
	const Ogre::Vector3 getMouseDirection(void) const;
	const float getMouseXDirection(void) const;
	virtual const float getMouseAngle(void) const;
	const Ogre::Quaternion getMouseRotation(void) const;
	// Running speed
	float mfSpeed;
	float mfMaxSpeed;
	float mfJumpPower;
	MoveState mMoveState;
	MoveState mCurrentAttack;
	ALuint mMoveSound;
	int mOrientation;
	float savedFriction;
	float mForceAir;
	map<MoveState, bool> mStates;
	void updateAirStatus(const unsigned long elapsedTime);
	void updateWallStatus(const unsigned long elapsedTime);
};

typedef boost::shared_ptr<MoveableObject> MoveableObjectPtr;

#endif